package Text_84;

import java.util.ArrayList;
import java.util.Collections;
import java.util.function.Predicate;

public class Code {

	public static void main(String[] args) {
		 //方法引用（成员方法）
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list,"郭靖","杨过","韦小宝","康熙","尔康","张三","李四","张三峰");
        list.stream().filter(s -> s.startsWith("张")).filter(s -> s.length()==3).forEach(s -> System.out.println(s));
        System.out.println("==============");
        list.stream().filter(new Predicate<String>() {
            @Override
            public boolean test(String s) {
                if (s.startsWith("张")){
                    boolean b = s.length() == 3;
                    return b;
                }
                return false;
            }
        }).forEach(s -> System.out.println(s));
        System.out.println("==============");
        list.stream().filter(new Cood()::StringJude).forEach(s -> System.out.println(s));

	}

}
